package com.ssy.lingxi.product.service;

import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.product.api.model.request.SimpleIdRequest;
import com.ssy.lingxi.product.api.model.request.channelCommodity.*;
import com.ssy.lingxi.product.api.model.request.commodity.CommodityDetailRequest;
import com.ssy.lingxi.product.api.model.request.feign.CommodityNameRequest;
import com.ssy.lingxi.product.api.model.request.feign.CommodityPriceRequest;
import com.ssy.lingxi.product.api.model.response.commodity.CommodityGoodsResponse;
import com.ssy.lingxi.product.api.model.response.commodity.CommodityOrderResponse;
import com.ssy.lingxi.product.api.model.response.commodity.CommoditySkuResponse;
import com.ssy.lingxi.product.api.model.response.commodity.CommodityStockResponse;
import com.ssy.lingxi.product.api.model.response.feign.CommodityPriceResponse;
import com.ssy.lingxi.product.entity.channelCommodity.ChannelCommodity;
import com.ssy.lingxi.product.entity.channelCommodity.ChannelCommodityMember;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

/**
 * 商品管理类
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/22
 */
public interface IChannelCommodityService {
    /**
     * 查询渠道会员商品
     * @param pageVO
     * @param channelCommodityQueryRequest
     */
    Page<ChannelCommodityMember> getChannelCommodityMemberList(PageVO pageVO, ChannelCommodityQueryRequest channelCommodityQueryRequest);

    /**
     * 查询渠道商品
     * @param pageVO
     * @param channelCommodityQueryRequest
     * @return
     */
    Page<ChannelCommodity> getChannelCommodityList(PageVO pageVO, ChannelCommodityQueryRequest channelCommodityQueryRequest);

    /**
     * 查询渠道会员商品
     * @param id
     */
    ChannelCommodityMember getChannelCommodityMember(Long id);

    /**
     * 查询渠道商品
     * @param id
     * @return
     */
    ChannelCommodity getChannelCommodityById(Long id);

    /**
     * 添加商品
     * @param sysUser
     * @param channelCommodityRequest
     * @return
     */
    Long saveChannelCommodity(UserLoginCacheDTO sysUser, ChannelCommodityRequest channelCommodityRequest);

    /**
     * 批量获取商品价格
     * @param commodityIdList
     * @return
     */
    Map<Long, Map<String, Double>> getCommodityPriceBatch(List<Long> commodityIdList);

    /**
     * 批量查询商品价格和是否允许使用会员权益
     * @param commoditySkuIdList
     * @return
     */
    Map<Long, CommodityPriceResponse> getCommodityPriceAndMemberPriceBatch(List<Long> commoditySkuIdList);

    /**
     * 修改渠道商品价格
     * @param sysUser
     * @param channelCommodityUpdateRequest
     * @return
     */
    Long updatePriceChannelCommodity(UserLoginCacheDTO sysUser, ChannelCommodityUpdateRequest channelCommodityUpdateRequest);

    /**
     * 批量删除商品
     * @param idList
     * @return
     */
    String deleteBatchChannelCommodity(UserLoginCacheDTO sysUser, List<Long> idList);

    /**
     * 删除渠道商品价格--未上架的状态
     * @param simpleIdRequest
     * @return
     */
    String deleteChannelCommodityPrice(SimpleIdRequest simpleIdRequest);

    /**
     * 渠道商品(单个上架/下架)
     * @param channelCommodityShopRequest
     * @return
     */
    String publishCommodity(UserLoginCacheDTO sysUser, ChannelCommodityShopRequest channelCommodityShopRequest);

    /**
     * 批量上架渠道商品
     * @param channelCommodityShopListRequest
     * @return
     */
    String batchPublishCommodity(UserLoginCacheDTO sysUser, ChannelCommodityShopListRequest channelCommodityShopListRequest);

    /**
     * 批量下架渠道商品
     * @param channelCommodityShopListRequest
     * @return
     */
    String batchOffPublishCommodity(UserLoginCacheDTO sysUser, ChannelCommodityShopListRequest channelCommodityShopListRequest);

    /**
     * 下架某个渠道会员的所有商品
     * @return
     */
    Boolean offPublishAllCommodity(Long memberId, Long memberRoleId);

    /**
     * 查询商品列表(按具体商品查询)--商品能力
     * @param pageVO 分页实体
     * @param commodityDetailRequest 查询条件实体
     * @return
     */
    PageData<CommodityGoodsResponse> getCommodityDetailList(PageVO pageVO, CommodityDetailRequest commodityDetailRequest, Long loginMemberId);

    /**
     * 查询商品列表(按会员商品规格查询)
     * @param pageVO 分页实体
     * @param commodityDetailRequest 查询条件实体
     * @return
     */
    PageData<CommodityStockResponse>  getCommodityDetailStockList(PageVO pageVO, CommodityDetailRequest commodityDetailRequest);

    /**
     * 查询所有渠道商品对应的商品id
     * @param memberId
     * @param memberRoleId
     * @return
     */
    List<Long> findCommodityIdByMember(Long memberId, Long memberRoleId);

    /**
     * 查询商品sku列表
     * @param pageVO 分页实体
     * @param commodityDetailRequest 查询条件实体
     * @return
     */
    PageData<CommoditySkuResponse>  getChannelCommoditySkuListByShopId(PageVO pageVO, CommodityDetailRequest commodityDetailRequest);

    /**
     * 判断商品是否上架
     * @return
     */
    String getCommodityIsPublish(Long shopId, List<CommodityNameRequest> commodityNameList);

    /**
     * 判断商品是否上架
     * @return
     */
    List<Long> getCommodityListByIsPublish(Long shopId, List<CommodityNameRequest> commodityNameList);

    /**
     * 查询商品信息列表--订单校验商品信息
     * @param commodityPriceRequest 查询条件实体
     * @return
     */
    List<CommodityOrderResponse> getCommodityListByOrder(CommodityPriceRequest commodityPriceRequest);
}
